{include file="public/header" /}
<body>
<div class="x-body">
    <form class="layui-form">
        <div class="layui-form-item">
            <label class="layui-form-label">设备编号</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input" name="eqpmt_id" value="{$equi_id}" title="禁止修改" disabled>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">保养计划</label>
            <div class="layui-input-inline">
                <input type="text" name="maintenance_plan_date" id="maintenance_plan_date" lay-verify="date" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">保养内容</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" name="maintenance_content">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">保养结果</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" name="maintenance_result">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">检查日期</label>
            <div class="layui-input-block">
                <input type="text" name="check_date" id="check_date" lay-verify="date" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">负责人</label>
            <div class="layui-input-block">
                <input type="text" name="person" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">检查人</label>
            <div class="layui-input-block">
                <input type="text" name="inspector" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-block">
                <input type="text" name="remarks" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"></label>
            <button class="layui-btn" lay-submit lay-filter="addId" >
                确认添加
            </button>
        </div>
    </form>
</div>
</body>
<script>
    //日期
    layui.use('laydate', function(){
        var laydate = layui.laydate;
        //执行一个laydate实例
        laydate.render({
            elem: '#check_date' //指定元素
        });
        laydate.render({
            elem: '#maintenance_plan_date' //指定元素
        });
    });
    layui.use(['form'], function(){
        $ = layui.jquery;
        var form = layui.form,layer = layui.layer;
        //监听提交
        form.on('submit(addId)', function(data){
            //console.log(data);
            $.post("{:url('index/EquipmentRepair/saveRepairInfo')}",data.field,function(info){
                if (info) {
                    layer.alert("添加成功", {icon: 6},function () {
                        window.parent.location.reload();  //刷新父级页面
                        // 获得frame索引
                        var index = parent.layer.getFrameIndex(window.name);
                        //关闭当前弹出层
                        parent.layer.close(index);
                    });
                }else{
                    layer.alert("添加失败", {icon: 5});
                }
            },'json');
            return false;
        });
    });
</script>

</html>